package com.liuc.practice.mvcapplication.controller;

import com.liuc.practice.mvcapplication.service.DemoService;
import com.liuc.practice.mvcframework.annotation.MyAutowired;
import com.liuc.practice.mvcframework.annotation.MyController;
import com.liuc.practice.mvcframework.annotation.MyRequestMapping;
import com.liuc.practice.mvcframework.annotation.MySecurity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author Liu Chang
 * @Date 2021/4/21 6:22 下午
 */

@MyController
@MyRequestMapping("/demo")
@MySecurity({"tom", "jerry"})
public class DemoController {

    @MyAutowired
    private DemoService service;

    @MyRequestMapping("/query1")
    public String query1(HttpServletRequest request, HttpServletResponse response, String name) {
        return service.get(name);
    }

    @MyRequestMapping("/query2")
    @MySecurity("dog")
    public String query2(HttpServletRequest request, HttpServletResponse response, String name) {
        return service.get(name);
    }
}
